package org.exhibition.controller;


import org.common.util.Result;
import org.exhibition.service.IUserTicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zafkiel
 * @since 2025-07-16
 */
@RestController
@RequestMapping("/exhibition")
public class UserTicketController {
    @Autowired
    private IUserTicketService iUserTicketService;

    //获取用户订单
    @GetMapping("/userOrder/{id}")
    public Result getUserOrder(@PathVariable("id")Integer id, @RequestParam("exhibitionName") String ExhibitionName){
        return iUserTicketService.getUserOrder(id,ExhibitionName);
    }
    //支付订单
    @PutMapping("/payOrder")
    public Result payOrder(@RequestBody Long orderId){
        if(iUserTicketService.payOrder(orderId)>0){
            return Result.success("支付成功");
        }else return Result.error("支付失败");
    }

}
